import request from '@/utils/request'

export function getEmployeeList (params) {
  return request({
    url: '/sys/user',
    method: 'GET',
    params
  })
}

export function exportExcel () {
  return request({
    url: '/sys/user/export',
    method: 'GET',
    responseType: 'blob'
  })
}

export function importTemplateExcel () {
  return request({
    url: '/sys/user/import/template',
    method: 'GET',
    responseType: 'blob'
  })
}

export function importExcel (data) {
  return request({
    url: '/sys/user/import',
    method: 'POST',
    data,
    responseType: 'blob'
  })
}

export function delEmployeeList (id) {
  return request({
    url: '/sys/user/' + id,
    method: 'DELETE',
    id
  })
}

export function addEmployeeList (data) {
  return request({
    url: '/sys/user',
    method: 'POST',
    data
  })
}

export function getEmployeeDetail (id) {
  return request({
    url: '/sys/user/' + id,
    method: 'GET'
  })
}

export function updateEmployee (data) {
  return request({
    url: '/sys/user/' + data.id,
    method: 'PUT',
    data
  })
}

// 角色分配
export function getRoleList () {
  return request({
    url: '/sys/role/list/enabled',
    method: 'GET'
  })
}

// 修改
export function assignRoles (data) {
  return request({
    url: '/sys/user/assignRoles',
    method: 'PUT',
    data
  })
}

